﻿@namespace BulmaRazor.Components
@inherits BulmaComponentBase

@if (Href.HasValue())
{
    <a @attributes="Attributes" class="@clesses" href="@Href" target="@Target">
        @ChildContent
    </a>
}
else
{
    <div @attributes="Attributes" class="@clesses">
        @ChildContent
    </div>
}

@code {

    string clesses => CssBuilder.Default("dropdown-item")
        .AddClassFromAttributes(Attributes)
        .AddClass("is-active", IsActive)
        .Build();

    /// <summary>
    /// 子内容
    /// </summary>
    [Parameter]
    public RenderFragment ChildContent { get; set; }

    /// <summary>
    /// 是否当前
    /// </summary>
    [Parameter]
    public bool IsActive { get; set; }

    /// <summary>
    /// 链接地址
    /// </summary>
    [Parameter]
    public string Href { get; set; }

    /// <summary>
    /// 链接目标
    /// </summary>
    [Parameter]
    public string Target { get; set; } = "_self";

}